Skip to content

Fix AwaitMessageTriggerFunctionSensor not honoring timeout - #69639

Open
TimurRakhmatullin86 wants to merge 1 commit into
apache:mainfrom
TimurRakhmatullin86:fix/kafka-trigger-function-sensor-timeout
Open

Fix AwaitMessageTriggerFunctionSensor not honoring timeout#69639
TimurRakhmatullin86 wants to merge 1 commit into
apache:mainfrom
TimurRakhmatullin86:fix/kafka-trigger-function-sensor-timeout

Conversation

@TimurRakhmatullin86

Copy link
Copy Markdown

AwaitMessageTriggerFunctionSensor accepts a timeout parameter and its docstring promises "Time elapsed before the task times out and fails", but neither defer() call passed timeout=, so the trigger could wait indefinitely and the parameter was silently ignored.

This applies the same fix that was merged for the sibling AwaitMessageSensor in #62104 (issue #62097): convert the numeric sensor timeout to a timedelta and pass it to defer() — here in both execute and execute_complete, since this sensor re-defers after every processed event.

Semantics note: because this sensor re-defers indefinitely by design, the timeout applies to each await cycle rather than to total task runtime — i.e. the task fails (or skips, with soft_fail=True) if no matching message arrives within timeout seconds of the most recent deferral. Total-elapsed semantics would unconditionally kill a healthy, indefinitely-running sensor, so per-cycle is the useful interpretation; happy to adjust if maintainers prefer otherwise.

On deferral timeout the standard sensor machinery converts TaskDeferralTimeout into AirflowSensorTimeout, and soft_fail is honored.

Adds a regression test asserting the timeout is forwarded on both deferral paths (it was None before this fix).

Signed-off-by: Timur Rakhmatullin <174210871+TimurRakhmatullin86@users.noreply.github.com>
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants